<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019-10-24
 * Time: 上午 11:10
 */

namespace App\Lib\DingDingNotice;


class LogisticsStagnation extends BaseNotice
{
    /*
     * $data 数据
     * $token 钉钉token
     * $atMobiles 需要at的人
     * $isAtall 是否at所有人
     * */
    public function __construct($data,$token,$atMobiles = [],$isAtall = false)
    {
        $str = '';

        foreach ($data as $item){
            $str .= "\n\n > 订单号: ".$item['order_id'];
            $str .= "\n\n > 店 铺: ".$item['shop_name'];
            $str .= "\n\n > 收件人: ".$item['post_receiver'];
            $str .= "\n\n > 电 话: ".$item['post_tel'];
            $str .= "\n\n > 停 滞: ".$item['timeLast']."天";
            $str .= "\n\n >=======================";
        }
        $str .= "\n\n >发送时间:".date("Y-m-d H:i:s");
        $str .= "\n\n > 下载 : http://dd.youdnr.com/api/logistics/stagnation_exp";
        $this->template = [
            "title"=>'物流停滞通知',
            'text'=>"#### 物流停滞通知".$str
        ];
        $this->token = $token;
        $this->atMobiles = $atMobiles;
        $this->isAtall = $isAtall;
    }

}